package com.example.administrator.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class Main2Activity extends AppCompatActivity {

    private TextView nameTv;
    private TextView scoreTv;
    private TextView ispassedTv;
    private String username;
    private int score;
    private Boolean ispassed;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        initView();
        initData();
        initEvent();
    }
    private void initEvent(){

    }
    private void initView(){
        nameTv = findViewById(R.id.tv1);
        scoreTv = findViewById(R.id.tv2);
        ispassedTv = findViewById(R.id.tv3);
    }
    private void initData(){

//       Intent intent =getIntent();
        Bundle bundle =getIntent().getExtras();
        username = bundle.getString("name");
        score = bundle.getInt("score");
        ispassed =bundle.getBoolean("ispassed");

//        username = intent.getStringExtra("name");
//        score = intent.getIntExtra("score",0);
//        ispassed = intent.getBooleanExtra("ispassed",true);

        nameTv.setText(username+"");
        scoreTv.setText(score+"");
        ispassedTv.setText(ispassed+"");
    }

}
